/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.openbrew.openbrewrf;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dchapman
 */
@Entity
@Table(name = "posProdTemplate")
@XmlRootElement
public class POSProdTemplate implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "templateID")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Column(name = "price")
    private float price;
    @OneToOne
    @JoinColumn(name = "glassware", referencedColumnName = "glassWareID", nullable=false)
    private POSGlassWare glassware;

    public POSProdTemplate() {
    }

    public POSProdTemplate(Integer id) {
        this.id = id;
    }

    public POSProdTemplate(Integer id, float price) {
        this.id = id;
        this.price = price;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public float getPrice() {
        return price;
    }

    public void setPrice(float price) {
        this.price = price;
    }

    public POSGlassWare getGlassware() {
        return glassware;
    }

    public void setGlassware(POSGlassWare glassware) {
        this.glassware = glassware;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof POSProdTemplate)) {
            return false;
        }
        POSProdTemplate other = (POSProdTemplate) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.openbrew.openbrewrf.posprodtemplate[ id=" + id + " ]";
    }
}
